home *** CD-ROM | disk | FTP | other *** search
- <!--- This example shows the use of CFSCRIPT --->
- <HTML>
- <HEAD>
- <TITLE>CFSCRIPT Example</TITLE>
- </HEAD>
-
- <BASEFONT FACE="Arial, Helvetica" SIZE=2>
- <BODY bgcolor="#FFFFD5">
-
- <H3>CFSCRIPT Example</H3>
-
- <P>CFSCRIPT adds a simple scripting language to Cold Fusion
- for those developers who are more comfortable with Javascript
- or VBScript syntax.
-
- <P>This simple example shows variable declaration and
- manipulation.
-
- <CFIF IsDefined("form.myValue")>
- <CFIF IsNumeric(form.myValue)>
- <CFSET x=form.myValue>
-
- <CFSCRIPT>
- y = x;
- z = 2 * y;
- StringVar = form.myString;
- </CFSCRIPT>
-
- <CFOUTPUT>
- <P>twice #x# is #z#.
- <P>Your string value was: <B><I>#StringVar#</I></B>
- </CFOUTPUT>
- <CFELSE>
- <H3>Please enter a valid number</H3>
- </CFIF>
- </CFIF>
-
- <FORM ACTION="cfscript.cfm" METHOD="post">
- <P>Input a value, and then run the template to double the value.
- <P><INPUT TYPE="Text" NAME="myValue" VALUE="45">
- <P>Input a string, and see it appear as well.
- <P><INPUT TYPE="Text" NAME="myString" VALUE="This is a sample string">
- <P><INPUT TYPE="Submit" NAME="" VALUE="double my value">
- </FORM>
-
- </BODY>
- </HTML>
-